<template>
	<view class="grid-list flex">
		<view class="grid-item" v-for="(item,index) in list" :key="index" @click="gridClick(item,index)">
			<view class="img-box">
				<image class="img" :src="item.icon" mode=""></image>
			</view>
			<view class="grid-title">
				{{item.title}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		props: {
			list: {
				type: Array,
				default: () => {
					return [];
				}
			}
		},
		methods: {
			gridClick(item,index) {
				this.$emit('gridClick', item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.grid-list {
		flex-wrap: wrap;

		.grid-item {
			width: 20%;
			// flex: 1;
			text-align: center;
			margin-top: 40rpx;

			&:nth-child(-n + 5) {
				margin-top: 0;
			}

			.img-box {
				width: 80rpx;
				height: 80rpx;
				margin: 0 auto;

				.img {
					width: 80rpx;
					height: 80rpx;
				}
			}

			.grid-title {
				margin-top: 10rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #222222;
			}
		}
	}
</style>